package com.dbManage.page.project;

import com.dbManage.dao.ProjectDao;
import com.dbManage.entity.Project;
import com.dbManage.entity.User;
import com.dbManage.tools.SessionTool;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class ProjectService {
    @Resource
    ProjectDao projectDao;
    public List<Project> getProject() {
        List<Project> list=projectDao.findProject();
        return list;
    }
    public Project findProjectById(int id) {
        return projectDao.findProjectById(id);
    }
    public void addProject(Project project) {
        User user= SessionTool.getUser();
        project.setAddId(user.getId());
        project.setAddName(user.getNickName());
        projectDao.insertProject(project);
    }
    public void updateProject(Project project) {
        projectDao.updateProject(project);
    }


}
